package com.zye.service;


import com.zye.dao.StudentDAO;
import com.zye.dao.StudentDAOImpl;
import com.zye.entity.Student;
import com.zye.service.StudentService;

import java.util.List;

public class StudentServiceImpl implements StudentService {

    private StudentDAO studentDAO = new StudentDAOImpl();

    @Override
    public List<Student> findAllStudents() {
        return studentDAO.selectAllStudents();
    }

    @Override
    public List<Student> findStudentByWord(String word){return studentDAO.selectStudentByWord(word);}

    @Override
    public Student findStudentById(int id) {
        return studentDAO.selectStudentById(id);
    }

    @Override
    public void addStudent(Student student) {
        studentDAO.insertStudent(student);
    }

    @Override
    public void updateStudentById(Student student) {
        studentDAO.updateStudentById(student);
    }

    @Override
    public void removeStudentById(int id) {
        studentDAO.deleteStudentById(id);
    }
}
